define(['utils', 'apis'], function(util, apis) {
  const ajax = util.ajax;

  return {
    /**
     * 操作日志
     * ?type=1&startTime=&endTime=&username=
     *
     * @param startTime
     * @param endTime
     * @param username
     * @param type
     * @returns {*}
     */
    getSysLog(startTime, endTime, username, type = 1) {
      return ajax(apis.userInfo, { params: { startTime, endTime, username, type } })
    },

    /**
     * 自定义信息
     * ?id=&customInfo=
     *
     * @param id
     * @param customInfo
     * @returns {*}
     */
    getUser(id, customInfo) {
      return ajax(apis.sysUser, { params: { id, customInfo } })
    },

    /**
     * 系统用户信息
     *
     * @returns {*}
     */
    getSysUserInfo() {
      return ajax(apis.sysUserInfo)
    },

    /**
     * 菜单
     *
     * @returns {*}
     */
    getMenus() {
      return ajax(apis.menus)
    },

    /**
     * 弹框中的菜单权限
     *
     * @returns {*}
     */
    getMenuForRole() {
      return ajax(apis.menuForRole)
    },

    /**
     * 角色
     *
     * @returns {*}
     */
    getRole() {
      return ajax(apis.role)
    },

    /**
     * 角色 - 单个
     *
     * @param id
     * @returns {*}
     */
    getRoleItem(id) {
      return ajax(apis.role, { path: { id } })
    },

    /**
     * 请求地区数据
     *
     * @returns {*}
     */
    getSelectByArea() {
      return ajax(apis.selectByArea)
    },

    /**
     * 用户权限 - 单个
     *
     * @returns {*}
     */
    getSysUserAuthItem(id) {
      return ajax(apis.sysUserAuthItem, { path: { id } })
    },
    fenceAreaGet(drawingType, name, remark) {
      return ajax(apis.fenceArea, { params: { drawingType, name, remark } })
    },
    fenceAreaPost(data) {
      return ajax(apis.fenceArea, { data, method: 'POST' })
    },
    fenceAreaPut(data) {
      return ajax(apis.fenceArea, { data, method: 'PUT' })
    },
    fenceAreaDel(id) {
      return ajax(apis.fenceAreaItem, { path: { id }, method: 'DELETE' })
    },

    assessCriterionPost(data) {
      return ajax(apis.assessCriterion, { data, method: 'POST' })
    },
    assessCriterionPut(data) {
      return ajax(apis.assessCriterion, { data, method: 'PUT' })
    },
    assessCriterionDel(id) {
      return ajax(apis.assessCriterionItem, { path: { id }, method: 'DELETE' })
    },

    alarmAreaSettingGet(name, analyzeType) {
      return ajax(apis.alarmAreaSetting, { params: { analyzeType, name } })
    },
    alarmAreaSettingPost(data) {
      return ajax(apis.alarmAreaSetting, { data, method: 'POST' })
    },
    alarmAreaSettingPut(data) {
      return ajax(apis.alarmAreaSetting, { data, method: 'PUT' })
    },
    alarmAreaSettingDel(id) {
      return ajax(apis.alarmAreaSettingItem, { path: { id }, method: 'DELETE' })
    },
    getUserInfo() {
      return ajax(apis.sysUserInfo)
    },

    login(username, password) {
      return ajax(apis.authenticate, { data: { username, password }})
    },

    userInfoGet() {
      return ajax(apis.sysUserInfo)
    },

    platformInformationGet () {
      return ajax(apis.homePlatformInformation)
    },

    digitalStatisticsAreaGet () {
      return ajax(apis.digitalStatisticsArea)
    },

    areaMigrateBySXGet () {
      const params = {
        status: 'out',
        areaCode: 610000,
        transType: '1,2,3',   //参数
        type: 1
      };
      return ajax(apis.getAreaMigrateBySX, { params })
    },

    alarmInfoTodayGet () {
      return ajax(apis.alarmInfoToday)
    },
  }
});


var dataSource = [
  {
    menuName: '11111',
    menuItem: [
      {menuName: '实时监控'},
      {menuName: '历史区域查车'},
      {menuName: '视频监控'},
    ]
  }, {
    menuName: '22222',
    menuItem: [
      {menuName: '录像回放'},
      {menuName: '录像回放历史记录'},
      {menuName: '报警中心'},
    ]
  }, {
    menuName: '33333',
    menuItem: [
      {menuName: '查岗中心'},
      {menuName: '公告中心'},
      {menuName: '部平台信息'},
      {menuName: '下级平台信息'},
      {menuName: '交换车辆信息'},
    ]
  }, {
    menuName: '44444',
    menuItem: [
      {menuName: '交换平台信息'},
      {menuName: '地区考核'},
      {menuName: '企业考核'},
      {menuName: '平台考核'},
      {menuName: '车辆跨域分析'},
    ]
  },
];
